package leetcode.templates.stacks;

public class MaxStack {
	int[] stack;
	int len;
	int p;

	public MaxStack(int len) {
		this.stack = new int[len];
		this.len = len;
		this.p = 0;
	}

	public void add(int val) {
		this.stack[p++] = val;
	}

	public int peek() {
		return this.stack[this.p - 1];
	}

	public int pop() {
		return this.stack[--this.p];
	}

	public boolean isEmpty() {
		return this.p == 0;
	}
}
